package org.jwt.oauth.service.impl;

import javax.servlet.http.HttpServletRequest;

import org.jwt.oauth.password.FusionPasswordEncoder;
import org.jwt.oauth.tools.HttpServletTool;
import org.jwt.oauth.user.FusionUserDetails;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

@Component
public class LoginUserServiceImpl implements UserDetailsService {

	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		HttpServletRequest request = HttpServletTool.getRequest();
		String parameter = request.getParameter("loginType");
		System.out.println(parameter);
		FusionPasswordEncoder fusionPasswordEncoder = new FusionPasswordEncoder();
		String encode = fusionPasswordEncoder.encode("123456");
		FusionUserDetails fusionUserDetails = new FusionUserDetails(username, encode);
		fusionUserDetails.putResponse("abc", "222222222222222222222222");
		fusionUserDetails.putData("data", "data");
		return fusionUserDetails;
	}

}
